<%#
 Copyright (C) 2018-2019 Lienol
 Licensed to the public under the Apache License 2.0.
-%>

<% include("cbi/map") %>
<script type="text/javascript">//<![CDATA[
	XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "vpn", "homeconnect", "status")%>', null,
		function(x, result)
		{
			var status = document.getElementsByClassName('softethervpn_status')[0];
			status.setAttribute("style","font-weight:bold;");
			status.setAttribute("color",result.status ? "green":"red");
			status.innerHTML = result.status?'<%=translate("RUNNING")%>':'<%=translate("NOT RUNNING")%>';
			
			var operatePanel = document.getElementById('homeconnect_mgt');
			if(result.status)
			{
				if((operatePanel && operatePanel.offsetParent  === null)){
					operatePanel.style.display = "block";
					setTimeout( function(){
						 loadPanel();
					}, 1 * 1000 );
				}
			}
			else
			{
				if(!(operatePanel && operatePanel.offsetParent  === null)){
					operatePanel.style.display = "none";
				}
			}
		}
	)
//]]>
</script>
